#include <stdio.h>

#define STDIN
//#define DEBUG

int nim(int x, int y)
{
    double a, b;

    a = (1 + sqrt(5.0)) / 2;
    b = (3 + sqrt(5.0)) / 3;

    if (x == y)
        return 1;
    if (x > y)
    {
        int t = x;
        x = y;
        y = t;
    }
    return (x!= (long)floor((y-x) * a));
}

int main()
{
#ifdef STDIN
    freopen("bin/1067.in", "r", stdin);
#endif

    int a, b;

    while(scanf("%d %d", &a, &b) == 2)
    {
        printf("%d\n", nim(a, b));
    }

    return 0;
}
